package Entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import VOs.CompanyVO;

@Entity
public class Company {

	/**
	 * @uml.property name="id"
	 */
	@Id
	private int id;
	/**
	 * @uml.property name="name"
	 */
	@Column(name = "\"NAME\"")
	private String name;
	/**
	 * @uml.property name="symbol"
	 */
	private String symbol;
	/**
	 * @uml.property name="description"
	 */
	private String description;
	@ManyToOne
	private Market market;
	@OneToMany(mappedBy = "company")
	private List<Stock> stocks;
	
	public CompanyVO tovo(){
		CompanyVO vo = new CompanyVO();
		vo.setDescription(getDescription());
		vo.setId(getId());
		vo.setName(getName());
		vo.setSymbol(getSymbol());
		vo.setMarket(getMarket());
		vo.setStocks(getStokes());
		
		return vo;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSymbol() {
		return symbol;
	}

	public void setSymbol(String symbol) {
		this.symbol = symbol;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Market getMarket() {
		return market;
	}

	public void setMarket(Market market) {
		this.market = market;
	}

	public List<Stock> getStokes() {
		return stocks;
	}

	public void setStokes(List<Stock> stocks) {
		this.stocks = stocks;
	}

}
